]>
Commit | Line | Data |
---|---|---|
2faffece P |
1 | IDENTIFICATION DIVISION |
2 | PROGRAM-ID Damped_Oscillator | |
3 | ||
4 | ENVIRONMENT DIVISION | |
5 | ENGINE Anabrid-THAT | |
6 | TIMEBASE 1ms | |
7 | REQUIRES COEFFICIENT 5 | |
8 | REQUIRES INTEGRATOR 2 | |
9 | REQUIRES INVERTER 1 | |
10 | REQUIRES SUMMER 2 | |
11 | ||
12 | DATA DIVISION | |
f25252dd | 13 | OUTPUT OUTPUT.U y |
2faffece P |
14 | ALIAS COEFFICIENT.1 InitialPosition |
15 | ALIAS COEFFICIENT.2 InitialSpeed | |
16 | ALIAS COEFFICIENT.3 SpringForce | |
17 | ALIAS COEFFICIENT.4 Damping # linear to speed | |
18 | ALIAS COEFFICIENT.5 Mass # 1 / mass | |
19 | ||
20 | PROGRAM DIVISION | |
21 | # Colors being used for wiring | |
22 | # - black: y0 | |
23 | # - blue: y0’ | |
24 | # - green: y0’’ | |
25 | # - yellow: y’’, y’ | |
26 | # - red: y | |
27 | -1 -> InitialPosition -> -y0 # -initial position of the mass | |
28 | -1 -> InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1 | |
29 | +1, y0s’, y0s’ -> Summer.1 -> y0’ | |
30 | ||
31 | y’’, IC:y0’ -> INTEGRATOR.1 -> -y’ | |
32 | -y’,IC:-y0 -> INTEGRATOR.2 -> y | |
33 | y -> SpringForce -> S*y # springforce times displacement | |
34 | -y’ -> INVERTER.1 -> y’ | |
35 | y’ -> Damping -> D*y’ # damping times speed | |
36 | 10:S*y, 10:D*y’ -> SUMMER.2 -> -(Dy’+Sy) | |
37 | -(Dy’+Sy) -> Mass -> -1/m*(Dy’+Sy)=y’’ | |
38 | ||
39 | OPERATION DIVISION | |
40 | MODE REPEAT | |
41 | OP-TIME 57ms |